/*
 * UIAlgebraInfo.java
 *
 * Created on 22 maart 2007, 10:01
 *
 * This file is part of SimpLie.
 * 
 * SimpLie is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * SimpLie is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with SimpLie.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

package edu.simplie.ui.reusable;

import edu.simplie.Helper;
import edu.simplie.algebra.Algebra;

/**
 *
 * @author  Teake Nutma
 * @version $Revision: 411 $, $Date: 2009-04-27 09:42:20 +0000 (Mon, 27 Apr 2009) $
 */
public class UIAlgebraInfo extends javax.swing.JPanel
{
	
	/**
	 * Creates new form UIAlgebraInfo
	 */
	public UIAlgebraInfo()
	{
		initComponents();
	}
	
	public void setTitle(String title)
	{
		setBorder(javax.swing.BorderFactory.createTitledBorder(null, title, javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 12)));
	}
		
	public void update(Algebra algebra)
	{
		algebraInfoType.setText(algebra.typeHTML);
		algebraInfoRank.setText(Helper.intToString(algebra.rank));
		algebraInfoDim.setText(algebra.dimension);
		algebraInfoCMDet.setText(Helper.intToString(algebra.det));
		algebraInfoCMrank.setText(Helper.intToString(algebra.rankA));
		algebraInfoCoxNum.setText(Helper.intToString(algebra.coxeterNumber));
		algebraInfoDualCoxNum.setText(Helper.intToString(algebra.dualCoxeterNumber));
	}
	
	/** This method is called from within the constructor to
	 * initialize the form.
	 * WARNING: Do NOT modify this code. The content of this method is
	 * always regenerated by the Form Editor.
	 */
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel4 = new javax.swing.JLabel();
        algebraInfoType = new javax.swing.JLabel();
        jPanel1 = new javax.swing.JPanel();
        jLabel3 = new javax.swing.JLabel();
        algebraInfoCMDet = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        algebraInfoCMrank = new javax.swing.JLabel();
        jLabel1 = new javax.swing.JLabel();
        algebraInfoRank = new javax.swing.JLabel();
        jPanel2 = new javax.swing.JPanel();
        tfCoxNum = new javax.swing.JLabel();
        algebraInfoCoxNum = new javax.swing.JLabel();
        tfDualCoxNum = new javax.swing.JLabel();
        algebraInfoDualCoxNum = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        algebraInfoDim = new javax.swing.JLabel();

        setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Algebra information", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 12))); // NOI18N

        jLabel4.setText("Type:");
        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(edu.simplie.SimpLieApp.class).getContext().getResourceMap(UIAlgebraInfo.class);
        jLabel4.setToolTipText(resourceMap.getString("algebra.typeDef")); // NOI18N

        algebraInfoType.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        algebraInfoType.setText("   ");
        algebraInfoType.setToolTipText(resourceMap.getString("algebra.typeDef")); // NOI18N

        jLabel3.setText("CM det:");
        jLabel3.setToolTipText(resourceMap.getString("algebra.cmDetDef")); // NOI18N

        algebraInfoCMDet.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        algebraInfoCMDet.setText("   ");
        algebraInfoCMDet.setToolTipText(resourceMap.getString("algebra.cmDetDef")); // NOI18N

        jLabel5.setText("CM rank:");
        jLabel5.setToolTipText(resourceMap.getString("algebra.cmRankDef")); // NOI18N

        algebraInfoCMrank.setText("   ");
        algebraInfoCMrank.setToolTipText(resourceMap.getString("algebra.cmRankDef")); // NOI18N

        jLabel1.setText("Rank:");
        jLabel1.setToolTipText(resourceMap.getString("algebra.rankDef")); // NOI18N

        algebraInfoRank.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        algebraInfoRank.setText("    ");
        algebraInfoRank.setToolTipText(resourceMap.getString("algebra.rankDef")); // NOI18N

        org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel1Layout.createSequentialGroup()
                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jLabel3)
                    .add(jLabel5)
                    .add(jLabel1))
                .add(15, 15, 15)
                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                    .add(algebraInfoRank, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 37, Short.MAX_VALUE)
                    .add(algebraInfoCMDet, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 37, Short.MAX_VALUE)
                    .add(algebraInfoCMrank, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 37, Short.MAX_VALUE)))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel1Layout.createSequentialGroup()
                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jLabel1)
                    .add(algebraInfoRank))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jLabel3)
                    .add(algebraInfoCMDet))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jLabel5)
                    .add(algebraInfoCMrank)))
        );

        tfCoxNum.setText("Coxeter number:");
        tfCoxNum.setToolTipText(resourceMap.getString("algebra.coxeterDef")); // NOI18N

        algebraInfoCoxNum.setText(" ");
        algebraInfoCoxNum.setToolTipText(resourceMap.getString("algebra.coxeterDef")); // NOI18N

        tfDualCoxNum.setText("Dual number:");

        jLabel2.setText("Dimension:");
        jLabel2.setToolTipText(resourceMap.getString("algebra.dimensionDef")); // NOI18N

        algebraInfoDim.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        algebraInfoDim.setText("    ");
        algebraInfoDim.setToolTipText(resourceMap.getString("algebra.dimensionDef")); // NOI18N

        org.jdesktop.layout.GroupLayout jPanel2Layout = new org.jdesktop.layout.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel2Layout.createSequentialGroup()
                .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(tfCoxNum)
                    .add(tfDualCoxNum)
                    .add(jLabel2))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(algebraInfoDim, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 38, Short.MAX_VALUE)
                    .add(algebraInfoCoxNum, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 38, Short.MAX_VALUE)
                    .add(algebraInfoDualCoxNum, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 38, Short.MAX_VALUE)))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel2Layout.createSequentialGroup()
                .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jLabel2)
                    .add(algebraInfoDim, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 14, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(tfCoxNum)
                    .add(algebraInfoCoxNum))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                    .add(tfDualCoxNum)
                    .add(algebraInfoDualCoxNum, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 14, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
        );

        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .addContainerGap()
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(layout.createSequentialGroup()
                        .add(jLabel4)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(algebraInfoType, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 193, Short.MAX_VALUE))
                    .add(layout.createSequentialGroup()
                        .add(jPanel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(jPanel2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jLabel4)
                    .add(algebraInfoType, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 29, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                    .add(jPanel2, 0, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .add(jPanel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );
    }// </editor-fold>//GEN-END:initComponents
	
	
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel algebraInfoCMDet;
    private javax.swing.JLabel algebraInfoCMrank;
    private javax.swing.JLabel algebraInfoCoxNum;
    private javax.swing.JLabel algebraInfoDim;
    private javax.swing.JLabel algebraInfoDualCoxNum;
    private javax.swing.JLabel algebraInfoRank;
    private javax.swing.JLabel algebraInfoType;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JLabel tfCoxNum;
    private javax.swing.JLabel tfDualCoxNum;
    // End of variables declaration//GEN-END:variables
	
}
